<?php
$content = '';

if (isset($GLOBALS['NAV_PATH']['parts'][1])) {
	switch ($GLOBALS['NAV_PATH']['parts'][1]) {
		case 'delete':
			$content .= CategoryComponents::getDeleteForm($params);
			break;
		case 'edit':
			$params = CategoryValidation::sanitiseInputs();
			if (isset($params['save']) && $params['save']) {
				if ($catId = oeCategory::create($params))
					header('Location: /category/edit?id='.$catId.'&save=true');
			}
			$content .= CategoryComponents::getCategoryEdit($params);
			break;
		default:
			$content .= CategoryComponents::getCategoryList();
			break;
	}
}
else {
	$content .= CategoryComponents::getCategoryList();
}



$pg = page::getInstance();
$pg->setTitle('category');
$pg->setContent($content);

$pg->printPage();